package com.baomidou.plugin.idea.mybatisx.advance.psi;

import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiManager;
import com.intellij.psi.impl.source.SourceTreeToPsiMap;
import com.intellij.psi.impl.source.tree.ChangeUtil;
import com.intellij.psi.impl.source.tree.TreeElement;
import com.intellij.psi.impl.source.tree.TreeGenerator;
import com.intellij.util.CharTable;
import org.jetbrains.annotations.Nullable;

/**
 * 找不到任何文档证明这个是干嘛用的，暂时留着后面如果发现没用就干掉 by wanglei
 * @author Plushnikov Michail
 */
public class MyLightMethodTreeGenerator implements TreeGenerator {

    public MyLightMethodTreeGenerator() {
    }

    @Nullable
    public TreeElement generateTreeFor(PsiElement original, CharTable table, PsiManager manager) {
        TreeElement result = null;
        if (original instanceof MyLightMethod)
            result = ChangeUtil.copyElement((TreeElement) SourceTreeToPsiMap.psiElementToTree(original), table);
        return result;
    }
}
